package de.java.shortys.myhome.api.controller.navigation;

import java.util.Map;
import java.util.TreeMap;

import de.java.shortys.myhome.api.controller.IController;

public class NavigationController {

	private static NavigationController instance;

	private IController activeSubModuleController;

	private Map<String, IController> navigators;

	{
		navigators = new TreeMap<String, IController>();
	}

	public IController getActiveSubModuleController() {
		return activeSubModuleController;
	}

	public void setActiveSubModuleController(IController active) {
		this.activeSubModuleController = active;
	}

	public static NavigationController getInstance() {
		if (instance == null) {
			instance = new NavigationController();
		}
		return instance;
	}

	public void jumpToModule(String moduleId) {
		navigators.get(moduleId).activate();
	}

	public void add(String moduleId, IController navigator) {
		navigators.put(moduleId, navigator);
	}

}
